<template>
  <div class="w-full ma-content-block rounded-sm p-3 mt-3">
    <div class="font-bold">最新订单</div>
    <a-table :data="data" :columns="columns" class="mt-2" :pagination="false">
    </a-table>
  </div>
</template>

<script setup>
import { ref, reactive } from 'vue'
import { useUserStore } from '@/store'
const userStore = useUserStore()

const data = ref([])
const columns = reactive([
  { title: '下单车辆', dataIndex: 'car_describe' },
  { title: '订单金额', dataIndex: 'total_price' },
  { title: '下单用户', dataIndex: 'member_nickname' },
  { title: '下单时间', dataIndex: 'created_at', width: 180, align: 'right' },
])

const row = ref({})

const getList = async () => {
  data.value = userStore.user && userStore.user.statistics ? userStore.user.statistics.latest_orders : []
}

getList()
</script>